<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="tfn" uri="http://www.totoro.com/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/nav.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/user/list_bought_items.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/iconFont/iconfont.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">

    <style>
        .el-input__inner {
            height: 30px;
        }

        .el-input__suffix {
            height: 35px;
        }

        .el-select .el-input .el-select__caret.is-reverse {
            margin-top: -9px;
        }

        .el-select-dropdown {
            margin: -5px 0;
            margin-top: -5px;
            margin-right: 0px;
            margin-bottom: -5px;
            margin-left: 0px
        }
        .icon-text-mod__time___3lKrq {
            color: #999;
            font-size: 18px;
        }

        table *{
            font-size: 12px;
        }
    </style>
</head>

<body id="list-bought-items" class="bought  mytaobao-v1  SCREEN1360 JS_SCREEN1360">
<script src="/static/js/frame/totoro-utils.js"></script>
<script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
<script src="${pageContext.request.contextPath}/static/js/frame/jquery-3.5.1.min.js"></script>

<div id="page">
    <jsp:include page="/public_page/nav.jsp"></jsp:include>
    <jsp:include page="${pageContext.request.contextPath}/public_page/ui_header.jsp"></jsp:include>
    <div id="content">
        <div class="grid-c2" id="mytaobao-panel">
            <div id="J_Col_Main" class="col-main">
                <div id="J_bought_main" style="margin-left:120px;min-height: 600px;">
                    <div id="tp-bought-root" class="index-mod__root___3ZrD7">
                        <div class="tabs-mod__container___ICzlj nav-mod__tabs___1D0ZI">
                            <div class="tabs-mod__main___74ZLv">
                                <div class="tabs-mod__tab___3vuhD">
											<a class="nav-mod__tab___1PnZ4" href="/user/boughtBaby.htm">
												<span class="nav-mod__text___3O7jT">所有订单</span>
											</a>
                                    <span class="tabs-mod__sep___waJNr">|</span>
                                </div>
                                <div class="tabs-mod__tab___3vuhD">
											<a class="nav-mod__tab___1PnZ4" href="/user/boughtBaby.htm?tabCode=waitPay">
												<span class="nav-mod__text___3O7jT">待付款</span>
											</a>
                                    <span class="tabs-mod__sep___waJNr">|</span>
                                </div>
                                <div class="tabs-mod__tab___3vuhD">
											<a class="nav-mod__tab___1PnZ4" href="/user/boughtBaby.htm?tabCode=waitSend">
												<span class="nav-mod__text___3O7jT">待发货</span>
											</a>
                                    <span class="tabs-mod__sep___waJNr">|</span>
                                </div>
                                <div class="tabs-mod__tab___3vuhD">
											<a class="nav-mod__tab___1PnZ4" href="/user/boughtBaby.htm?tabCode=waitConfirm">
												<span class="nav-mod__text___3O7jT">待收货</span>
											</a>
                                    <span class="tabs-mod__sep___waJNr">|</span>
                                </div>
                                <div class="tabs-mod__tab___3vuhD">
											<a class="nav-mod__tab___1PnZ4" href="/user/boughtBaby.htm?tabCode=waitRate">
												<span class="nav-mod__text___3O7jT">待评价</span>
											</a>
                                    <span class="tabs-mod__sep___waJNr">|</span>
                                </div>
                            </div>
                            <div class="tabs-mod__minors___3PnBm">
                                <div class="tabs-mod__tab___3vuhD tabs-mod__selected___2DHDY">
											<span id="recycleTab" class="nav-mod__tab___1PnZ4 nav-mod__recycle___2c0Pl" style="border-bottom-color: #ff6000;
    color: #ff6000;
    border-width: 0;">
												<img class="nav-mod__img___3LK9B"
                                                     src="//img.alicdn.com/tps/i4/TB1G5QqIFXXXXbvXFXXcmA2.FXX-11-12.png"
                                                     alt="订单回收站">
												<span class="nav-mod__text___3O7jT"
                                                      data-reactid=".0.0.1.$recycle.0.1">订单回收站</span>
											</span>
                                </div>
                            </div>
                        </div>
                        <div class="index-mod__ems-ad___3fP6L js-ems-ad">
                            <div>
                                <div>
                                    <span></span>
                                </div>
                            </div>
                        </div>
                        <span id="nav_anchor" style="visibility:hidden;height:0;"></span>
                        <table class="bought-table-mod__table___AnaXt table-head-mod__table___17eFg">
                            <colgroup>
                                <col class="bought-table-mod__col1___3U5RK">
                                <col class="bought-table-mod__col2___224Oh">
                                <col class="bought-table-mod__col3___J0oe0">
                                <col class="bought-table-mod__col4___XvKTC">
                                <col class="bought-table-mod__col5___2kktP">
                                <col class="bought-table-mod__col6___1KqCQ">
                                <col class="bought-table-mod__col7___PpB_p">
                            </colgroup>
                            <tbody>
                            <tr>
                                <th>宝贝</th>
                                <th>单价</th>
                                <th>数量</th>
                                <th>商品操作</th>
                                <th>实付款</th>
                                <th>
												<span
                                                        class="field-select-mod__select___xOMpt trade-select table-head-mod__status___SBEwU rc-select rc-select-enabled lk">
													<span class="rc-select-selection rc-select-selection--single">
														<span class="rc-select-selection__rendered">
															<span class="textt">交易状态</span>
														</span>
														<span class="rc-select-arrow" style="outline:none;">
															<b></b>
														</span>
													</span>
												</span>
                                    </span>
                                </th>
                                <th>交易操作</th>
                            </tr>
                            <div style="position: absolute; top: 0px; left: 0px; width: 100%;">
                                <div>
                                    <div class="rc-select-dropdown rc-select-dropdown--single rc-select-dropdown-placement-bottomLeft rc-select-dropdown-hidden"
                                         style="left: 947px; top: 198px; width: 118px;">
                                        <div>
                                            <ul
                                                    class="rc-select-dropdown-menu rc-select-dropdown-menu-vertical  rc-select-dropdown-menu-root">
                                                <li
                                                        class="rc-select-dropdown-menu-item-selected rc-select-dropdown-menu-item">
                                                    交易状态</li>
                                                <li class="rc-select-dropdown-menu-item">等待买家付款</li>
                                                <li class="rc-select-dropdown-menu-item">付款确认中</li>
                                                <li class="rc-select-dropdown-menu-item">买家已付款</li>
                                                <li class="rc-select-dropdown-menu-item">卖家已发货</li>
                                                <li class="rc-select-dropdown-menu-item">交易成功</li>
                                                <li class="rc-select-dropdown-menu-item">交易关闭</li>
                                                <li class="rc-select-dropdown-menu-item">退款中的订单</li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </tbody>
                        </table>
                        <div class="row-mod__row___1aPep js-actions-row-top">
                            <c:if test="${fn:length(marketOrderList) > 0}">
                                <div style="float:left;" class="operating">
                                    <label class="index-mod__select-all___2lWPl js-select-all">
                                        <input class="index-mod__checkbox___3mesI" type="checkbox">
                                        <span>全选</span>
                                    </label>
                                    <div class="batch-mod__container___sK68S">
                                        <button class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc batch-mod__button___2aEBk batch-delete">批量永久删除</button>
                                        <button class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc batch-mod__button___2aEBk batch-reduction">批量还原</button>
                                    </div>
                                </div>
                            </c:if>
                            <div style="float:right;width:;">
                                <div class="simple-pagination-mod__container___1pC5p">
                                    <button ${empty param.curr or param.curr == 1?'disabled':''}
                                            class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc simple-pagination-mod__prev___pJnpC prev-curr">上一页</button>
                                    <fmt:formatNumber var="c" value="${(allPage  +  10  - 1) / 10}" pattern="#"/>
                                    <button ${param.curr == c or c==1?'disabled':''}
                                            class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc next-curr">下一页</button>
                                </div>
                            </div>
                        </div>
                        <div class="index-mod__empty-list___3CaW2 js-empty-list" style="display: ${fn:length(marketOrderList) > 0?'none':'block'}">
                            <img class="index-mod__empty-list-img___3kyoO" src="//img.alicdn.com/tps/i3/T1MQ1cXhtiXXXXXXXX-78-120.png">
                            <span data-reactid=".0.7.1">没有符合条件的宝贝，请尝试其他搜索条件。</span>
                        </div>
                        <c:forEach items="${marketOrderList}" var="marketOrder" varStatus="vs">
                            <div class="index-mod__order-container___1ur4- js-order-container" data-mo-id="${marketOrder.id}">
                            <div class="bought-wrapper-mod__trade-order___2lrzV bought-wrapper-mod__closed___3pIh6">
                                <table class="bought-table-mod__table___AnaXt bought-wrapper-mod__table___3xFFM">
                                    <colgroup>
                                        <col class="bought-table-mod__col1___3U5RK">
                                        <col class="bought-table-mod__col2___224Oh">
                                        <col class="bought-table-mod__col3___J0oe0">
                                        <col class="bought-table-mod__col4___XvKTC">
                                        <col class="bought-table-mod__col5___2kktP">
                                        <col class="bought-table-mod__col6___1KqCQ">
                                        <col class="bought-table-mod__col7___PpB_p">
                                    </colgroup>
                                    <tbody class="bought-wrapper-mod__head___2vnqo">
                                    <tr>
                                        <td class="bought-wrapper-mod__head-info-cell___29cDO">
                                            <label class="bought-wrapper-mod__checkbox-label___3Va60">
															<span class="bought-wrapper-mod__checkbox___11anQ">
																<input type="checkbox">
															</span>
                                                <span class="bought-wrapper-mod__create-time___yNWVS">${tfn:formatDateByString(marketOrder.createTime)}</span>
                                            </label>
                                            <span>
															<span>订单号</span>
															<span>:</span>
															<span>${marketOrder.marketOdd}</span>
														</span>
                                        </td>
                                        <td colspan="2" class="bought-wrapper-mod__seller-container___3dAK3">
														<span class="seller-mod__container___zFAFV">
															<img src="//gtd.alicdn.com/tps/i2/TB1aJQKFVXXXXamXFXXEDhGGXXX-32-32.png"class="seller-mod__icon___2F6_V">
															<a href=""class="seller-mod__name___2IlQm" title="${marketOrder.shop.shopName}">${marketOrder.shop.shopName}</a>
														</span>
                                        </td>
                                        <td>
														<span id="webww2">
															<span class="ww-light ww-large">
																<a data-to-uid="${marketOrder.shop.slid}" class="ww-inline ww-online"title="点此可以直接和卖家交流选好的宝贝，或相互交流网购体验，还支持语音视频噢。">
																	<span>旺旺在线</span>
																</a>
															</span>
														</span>
                                        </td>
                                        <td colspan="3"class="bought-wrapper-mod__thead-operations-container___2LwDA">
                                            <span></span>
                                            <a href=""class="bought-wrapper-mod__th-operation___yRtHm"title="编辑标记信息，仅自己可见"id="flag">
                                                <i style="height:17px;width:1px;padding-left:17px;overflow:hidden;vertical-align:middle;font-si
															ze:0px;display:inline-block;background:url(//img.alicdn.com/tps/i1/TB1he
															yGFVXXXXXpXXXXR3Ey7pXX-550-260.png) no-repeat -176px -176px;">
                                                </i>
                                            </a>
                                            <a class="bought-wrapper-mod__th-operation___yRtHm always-visible"title="删除订单"id="delOrder">
                                                <i style="height:17px;width:1px;padding-left:17px;overflow:hidden;vertical-align:middle;font-size:0px;
															display:inline-block;visibility:visible;background:url(//img.alicdn.com/tps/i1/TB1heyGFVXXXXXpXXXXR3Ey7pXX-550-260.png)
															 no-repeat -239px -176px;">
                                                </i>
                                            </a>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tbody>
                                    <c:set var="rowSpanLen" value="${fn:length(marketOrder.marketSrOrderList)}"></c:set>
                            <c:forEach items="${marketOrder.marketSrOrderList}" var="marketSrOrder" varStatus="vs2">
                                    <tr>
                                        <td class="sol-mod__no-br___36X3g">
                                            <div class="ml-mod__container___2DOxT production-mod__production___123Ax suborder-mod__production___3WebF">
                                                <div class="ml-mod__media___2sZrj" style="width:80px;">
                                                    <a href="/buy.htm?pid=${marketSrOrder.product.id}&sid=${marketOrder.shop.id}&skuCode=0" class="production-mod__pic___G8alD" target="_blank">
                                                        <img src="${marketSrOrder.product.productImages[0].imagePath}">
                                                        <span></span>
                                                    </a>
                                                </div>
                                                <div style="margin-left:90px;">
                                                    <p>
                                                        <a href="/buy.htm?pid=${marketSrOrder.product.id}&sid=${marketOrder.shop.id}&skuCode=0">
                                                            <span></span>
                                                            <span style="line-height:16px;">${marketSrOrder.product.productName}</span>
                                                            <span></span>
                                                        </a>
                                                        <a href="/order//tradeSnap.htm?tradeID=${marketOrder.marketOdd}&detailID=${marketSrOrder.id}&snapShot=true" target="_blank">[交易快照] </a>
                                                        <span></span>
                                                        <span></span>
                                                    </p>
                                                    <p>
                                                            <%-- 格式化Skull --%>
                                                        <c:set var="skuData" value="${marketSrOrder.product.productSpecs.productSpaceData}"></c:set>
                                                        <c:set var="skuDatas" value='${fn:split(fn:replace(fn:replace(skuData, "{" , ""), "}", ""), ",")}'></c:set>
                                                                <c:forEach begin="0" end="${fn:length(skuDatas)}" var="i">
                                                                <span class="production-mod__sku-item___395gE">
                                                                    <span>${fn:split(fn:replace(skuDatas[hdVs.index], "\"", ""), "|")[0]}</span>
                                                                </span>
                                                                </c:forEach>
                                                    </p>
                                                    <p>
                                                        <a href=""title="正品保证" type="3" style="margin-right:8px;">
                                                            <img src="//img.alicdn.com/tps/i2/T1SyeXFpliXXaSQP_X-16-16.png">
                                                        </a>
                                                        <a href=""title="如实描述" type="3" style="margin-right:8px;">
                                                            <img src="//img.alicdn.com/tps/TB1PDB6IVXXXXaVaXXXXXXXXXXX.png">
                                                        </a>
                                                        <a href=""title="七天退换" type="3" style="margin-right:8px;">
                                                            <img src="//img.alicdn.com/tps/i3/T1Vyl6FCBlXXaSQP_X-16-16.png">
                                                        </a>
                                                    </p>
                                                </div>
                                            </div>
                                        </td>
                                        <td class="sol-mod__no-br___36X3g">
                                            <div class="price-mod__price___3_8Zs">
                                                <p>
                                                    <c:if test="${marketSrOrder.product.productSpecs.productPrice > marketSrOrder.payPrice/marketSrOrder.buyCount}">
                                                        <del class="price-mod__del___3kcDc">
                                                            <span>￥</span>
                                                            <span>${marketSrOrder.product.productSpecs.productPrice}</span>
                                                        </del>
                                                    </c:if>
                                                </p>
                                                <p>
                                                    <span>￥</span>
                                                    <span><fmt:formatNumber type="currency" pattern=".00" value="${marketSrOrder.payPrice/marketSrOrder.buyCount}"></fmt:formatNumber></span>
                                                </p>
                                            </div>
                                        </td>
                                        <td class="sol-mod__no-br___36X3g">
                                            <div>
                                                <p>${marketSrOrder.buyCount}</p>
                                            </div>
                                        </td>
                                        <td>
                                            <div>
                                                <p style="margin-bottom:3px;">
                                                    <span class="text-mod__link___1rXmw text-mod__hover___1TDrR">无</span>
                                                </p>
                                            </div>
                                        </td>
                                        <c:if test="${vs2.first}">
                                            <td class="" ${vs2.first?"rowspan="+=rowSpanLen:""}>
                                                <c:if test="${vs2.first}">
                                                    <div>
                                                        <div class="price-mod__price___3_8Zs">
                                                            <p>
                                                                <strong>
                                                                    <span>￥</span>
                                                                    <span><fmt:formatNumber type="currency" pattern=".00" value="${marketOrder.allPrice}"></fmt:formatNumber></span>
                                                                </strong>
                                                            </p></div>
                                                        <p style="color:#6c6c6c;font-family:verdana;">
                                                            <span>(含运费：</span>
                                                            <span>￥0.00</span>
                                                            <span></span>
                                                            <span></span>
                                                            <span>)</span>
                                                        </p>
                                                        <div style="font-family:verdana;">
                                                            <div></div>
                                                        </div>
                                                        <span></span>
                                                    </div>
                                                </c:if>
                                            </td>
                                        </c:if>
                                        <c:if test="${vs2.first}">
                                            <td class="" ${vs2.first?"rowspan="+=rowSpanLen:""}>

                                                <c:if test="${marketOrder.orderStatus == 1}">
                                                    <p style="margin-bottom:3px;">
                                                        <span class="text-mod__link___1rXmw">等待买家付款</span>
                                                    </p>

                                                    <div>
                                                    </div>
                                                </c:if>

                                                <c:if test="${marketOrder.orderStatus == 2}">
                                                    <p style="margin-bottom:3px;">
                                                        <span class="text-mod__link___1rXmw">等待卖家发货</span>
                                                    </p>
                                                    <div>
                                                    </div>
                                                </c:if>

                                                <c:if test="${marketOrder.orderStatus == 3}">
                                                    <p style="margin-bottom:3px;">
                                                        <span class="text-mod__link___1rXmw">等待买家收货</span>
                                                    </p>
                                                    <div>
                                                        <p style="margin-bottom:3px;">
                                                            <a href="" class="text-mod__link___1rXmw text-mod__primary___zjRQH text-mod__hover___1TDrR" id="viewLogistic" style="color: #f40">查看物流</a>
                                                        </p>
                                                    </div>
                                                </c:if>

                                                <c:if test="${marketOrder.orderStatus == 4}">
                                                    <p style="margin-bottom:3px;">
                                                        <span class="text-mod__link___1rXmw">交易完成</span>
                                                    </p>
                                                    <div>
                                                    </div>
                                                </c:if>

                                                <c:if test="${marketOrder.orderStatus == 5}">
                                                    <p style="margin-bottom:3px;">
                                                        <span class="text-mod__link___1rXmw">交易成功</span>
                                                    </p>
                                                </c:if>
                                                <div>
                                                    <p style="margin-bottom:3px;">
                                                        <a href="/order/ticket_trade_item_detail.htm?tradeId=${marketOrder.marketOdd}" class="text-mod__link___1rXmw text-mod__hover___1TDrR" target="_blank" rel="noopener noreferrer" id="viewDetail">订单详情</a>
                                                    </p>
                                                </div>
                                            </td>
                                        </c:if>
                                        <td class="">
                                            <div>
                                                <p style="margin-bottom:3px;">
                                                    <a class="text-mod__link___1rXmw text-mod__hover___1TDrR reduction">还原订单</a>
                                                </p>
                                            </div>
                                        </td>
                                    </tr>
                            </c:forEach>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                        </c:forEach>
                        <div class="row-mod__row___1aPep js-actions-row-bottom">
                            <c:if test="${fn:length(marketOrderList) > 0}">
                                <div style="float:left;" class="operating">
                                    <label class="index-mod__select-all___2lWPl js-select-all">
                                        <input class="index-mod__checkbox___3mesI" type="checkbox">
                                        <span>全选</span>
                                    </label>
                                    <div class="batch-mod__container___sK68S">
                                        <button class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc batch-mod__button___2aEBk batch-delete">批量永久删除</button>
                                        <button class="button-mod__button___2HDif button-mod__default___2pRKd button-mod__small___1a8rc batch-mod__button___2aEBk batch-reduction">批量还原</button>
                                    </div>
                                </div>
                            </c:if>
                            <!-- 分页 start-->
                            <div style="float:right;">
                                <div id="tmallPagination"></div>
                                <input type="hidden" id="allPage" value="${allPage}">
                                <!-- 分页 end-->
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 猜你喜欢 -->
                <jsp:include page="/public_page/your_like_two.jsp"></jsp:include>
            </div>
            <!-- 左侧菜单 start-->
            <jsp:include page="${pageContext.request.contextPath}/public_page/ui-left.jsp"></jsp:include>
            <style>
                #bought {
                    color: #f40;
                }
            </style>
            <!-- 左侧菜单 end-->
        </div>
    </div>
</div>
<div class="tm-dialog-container"style="display: none;">
    <div class="tm-dialog-wrap">
        <div class="tm-dialog-mask">
        </div>
        <div class="tm-dialog "style="left: 756px; top: 100px;">
            <div class="tm-dialog-content">
                <div class="tm-dialog-body">
                    <div class="confirm-mod__container___3XPq5">
                        <div class="confirm-mod__header___14yoA">您确定要删除该订单吗？</div>
                        <div class="confirm-mod__body___1J3we">
                            <span>删除后，您可在订单回收站找回，或永久删除。</span>
                            <div class="confirm-mod__inputs-container___3ozMb"></div>
                        </div>
                        <div class="confirm-mod__footer___1e5Qm">
                            <button class="button-mod__button___2Ew0a button-mod__secondary___RRGMH confirm-mod__button___ZUjXz">确定</button>
                            <button class="button-mod__button___2Ew0a button-mod__grey___3CiQ2 confirm-mod__button___ZUjXz">关闭</button>
                        </div>
                    </div>
                </div>
            </div>
            <div tabindex="0" style="width:0;height:0;overflow:hidden;">sentinel
            </div>
        </div>
    </div>
</div>
<div class="loading-mod__loading___3nGTY" style="display: none">
    <div class="loading-mod__bg___2ylNX loading-mod__q___3pSfD"></div>
    <div class="loading-mod__bg___2ylNX loading-mod__z___3Le9C"></div>
</div>
<jsp:include page="/public_page/last.html"></jsp:include>
<jsp:include page="/public_page/open_chat.jsp"></jsp:include>
</body>
<script>
    $(function() {
        // 点击批量删除所有订单
        $(".batch-delete").click(function () {
            // 判断已选择的订单数量，是否选择商品
            var $productCheckeBox = $(".js-order-container input[type='checkbox']:checked");
            if($productCheckeBox.length < 1){
                generateNotSelectedTips().appendTo($("body"));
                return false;
            }
            generateDeleteTips("您确定要永久删除该些订单吗？").appendTo($("body"));
            $(".ok-delete").off("click").on("click",function(){
                // 获取所有选中的订单的id
                var moIds = new Array();
                $(".loading-mod__loading___3nGTY").show();
                $productCheckeBox.each(function () {
                    var moId = $(this).parents(".js-order-container").attr("data-mo-id");
                    moIds.push(moId);
                    $(this).parents(".js-order-container").remove();
                });
                $("#deleteOrderDialog").remove();
                $.post("/order_logic/batchTrueDeleteOrder.htm", {"moIds": moIds}, res=>{
                })
                setTimeout(res=>{
                    $(".loading-mod__loading___3nGTY").hide();
                },300);
                emptyStatus();
            });
        });

        // 点击我知道了，关闭上方的提示框
        $("body").on("click", ".st-know", function () {
            $("#notSelectedDialog").remove();
        });




        //删除订单
        $(".always-visible").click(function(){
            var $moEl = $(this).parents(".js-order-container");
            $("body").append(generateDeleteTips("您确定要永久删除该订单吗？"));
            $(".ok-delete").off("click").on("click",function(){
                $(".loading-mod__loading___3nGTY").show();
                // 获取所有选中的订单的id
                var moIds = new Array();
                moIds.push($moEl.attr("data-mo-id"));
                $.post("/order_logic/batchTrueDeleteOrder.htm", {"moIds": moIds}, res=>{
                })
                setTimeout(res=>{
                    $moEl.remove();
                    $(".loading-mod__loading___3nGTY").hide();
                    emptyStatus();
                },300);
                $("#deleteOrderDialog").remove();
            });
        });

        // 批量还原
        $(".batch-reduction").click(function () {
            // 判断已选择的订单数量，是否选择商品
            var $productCheckeBox = $(".js-order-container input[type='checkbox']:checked");
            if($productCheckeBox.length < 1){
                generateNotSelectedTips().appendTo($("body"));
                return false;
            }
            // 获取所有选中的订单的id
            var moIds = new Array();
            $(".loading-mod__loading___3nGTY").show();
            $productCheckeBox.each(function () {
                var moId = $(this).parents(".js-order-container").attr("data-mo-id");
                moIds.push(moId);
                $(this).parents(".js-order-container").remove();
                setTimeout(res=>{
                    $(".loading-mod__loading___3nGTY").hide();
                },300);
            });
            $.post("/order_logic/batchReductionOrder.htm", {"moIds": moIds}, (res)=>{
            })
            emptyStatus();
        });

        // 点击还原
        $(".reduction").click(function () {
            var $moEl = $(this).parents(".js-order-container");
            var moIds = new Array();
            moIds.push($moEl.attr("data-mo-id"));
            $(".loading-mod__loading___3nGTY").show();
            $.post("/order_logic/batchReductionOrder.htm", {"moIds": moIds}, (res)=>{
            })
            setTimeout(res=>{
                $moEl.remove();
                $(".loading-mod__loading___3nGTY").hide();
                emptyStatus();
            },300);
        })

        // 点击关闭
        $("body").on("click", ".not", function(){
            $(".tm-dialog-container").remove();
        });

        $("body").on("click",".button-mod__secondary___RRGMH",function(){
            var $frame=$divDelete.parents(".js-order-container");
            $frame.remove();
            $(".tm-dialog-container").remove();
        });
        // 全选
        $(".index-mod__checkbox___3mesI").click(function(){
            if(this.checked) {
                $(".bought-wrapper-mod__checkbox___11anQ :checkbox").prop('checked',true);
                $(".index-mod__checkbox___3mesI").prop('checked',true);
            }else {
                $(".bought-wrapper-mod__checkbox___11anQ :checkbox").prop('checked',false);
                $(".index-mod__checkbox___3mesI").prop('checked',false);
            }
        });
        // 选择商品，如果商品都没被选择或者都被选择，则改变全选的状态
        $(".bought-wrapper-mod__checkbox___11anQ input[type='checkbox']").click(function () {
            var $allOrderCk = $(".bought-wrapper-mod__checkbox___11anQ input[type='checkbox']");
            var status = new Array();
            for (let i = 0; i < $allOrderCk.length; i++) {
                var ckStatus = $allOrderCk.eq(i).prop("checked");
                status.push(ckStatus);
            }
            if(status.includes(false)){
                $(".index-mod__checkbox___3mesI").prop("checked", false);
            } else {
                $(".index-mod__checkbox___3mesI").prop("checked", true);
            }
        })

        // 按钮控制分页开始
        $(".prev-curr").click(function () {
            var curr = Totoro.getQueryVariable("curr");
            if(curr == 1){
                return false;
            }
            window.location.href = "/user/list_recyled_items.htm?curr="+parseInt(curr)-1;
        });
        $(".next-curr").click(function () {
            var curr = Totoro.getQueryVariable("curr");
            if(curr == $("#allPage").val()){
                return false;
            }
            window.location.href = "/user/list_recyled_items.htm?curr="+parseInt(curr)+1;
        })
        // 页数控制分页开始
        layui.use(['laypage', 'layer'], function() {
            var laypage = layui.laypage
                , layer = layui.layer;
            //完整功能
            laypage.render({
                elem: 'tmallPagination'
                , count: $("#allPage").val()
                , theme: '#f40'
                , limit: 10
                , layout: ['count', 'prev', 'page', 'next', 'skip']
                , curr: Totoro.getQueryVariable("curr")
                , jump: function(obj, first){
                    //首次不执行
                    if(!first){
                        window.location.href = "/user/list_recyled_items.htm?curr="+obj.curr;
                    }
                }
            });
        });
    });

    // 生成删除提示
    var generateDeleteTips = function(msg){
        return $("<div class='tm-dialog-container' id='deleteOrderDialog'>\n" +
            "    <div class='tm-dialog-wrap'>\n" +
            "        <div class='tm-dialog-mask'>\n" +
            "        </div>\n" +
            "        <div class='tm-dialog ' style='left: 756px; top: 100px;'>\n" +
            "            <div class='tm-dialog-content'>\n" +
            "                <div class='tm-dialog-body'>\n" +
            "                    <div class='confirm-mod__container___3XPq5'>\n" +
            "                        <div class='confirm-mod__header___14yoA'>"+ msg +"</div>\n" +
            "                        <div class='confirm-mod__body___1J3we'>\n" +
            "                            <span>永久删除后，您将无法再查看该订单，也无法进行投诉维权，请谨慎操作！</span>\n" +
            "                            <div class='confirm-mod__inputs-container___3ozMb'></div>\n" +
            "                        </div>\n" +
            "                        <div class='confirm-mod__footer___1e5Qm'>\n" +
            "                            <button\n" +
            "                                class='button-mod__button___2Ew0a button-mod__secondary___RRGMH confirm-mod__button___ZUjXz ok-delete'>确定\n" +
            "                                </button>\n" +
            "                                    <button\n" +
            "                                        class='button-mod__button___2Ew0a button-mod__grey___3CiQ2 confirm-mod__button___ZUjXz not'>关闭\n" +
            "                                        </button>\n" +
            "                        </div>\n" +
            "                    </div>\n" +
            "                </div>\n" +
            "            </div>\n" +
            "            <div tabIndex='0' style='width:0;height:0;overflow:hidden;'>sentinel\n" +
            "            </div>\n" +
            "        </div>\n" +
            "    </div>\n" +
            "</div>");
    }

    // 生成未选择提示
    var generateNotSelectedTips = function (){
        return $("<div class='tm-dialog-container' id='notSelectedDialog'>" +
            "<div class='tm-dialog-wrap' data-reactid='.2'>" +
            "<div class='tm-dialog-mask' data-reactid='.2.$mask'></div>" +
            "<div class='tm-dialog alert-dialog' tabindex='0' role='dialog' style='width: 416px; left: 744px; top: 100px;' data-reactid='.2.$dialog'>" +
            "<div class='tm-dialog-content' data-reactid='.2.$dialog.0'>" +
            "<div class='tm-dialog-body' data-reactid='.2.$dialog.0.2'>" +
            "<div class='notify-mod__container___39iVE' data-reactid='.2.$dialog.0.2.0' data-spm-anchor-id='a1z09.12.0.i1.11ca2e8dcLfBkB'>" +
            "<div class='body' data-reactid='.2.$dialog.0.2.0.0'>请选择订单进行操作, 可以选择多个</div>" +
            "<div class='notify-mod__footer___1TxS-' data-reactid='.2.$dialog.0.2.0.1' data-spm-anchor-id='a1z09.12.0.i2.11ca2e8dcLfBkB'>" +
            "<button class='button-mod__button___2HDif button-mod__secondary___YOx64 button-mod__button___2HDif st-know' data-reactid='.2.$dialog.0.2.0.1.0'>知道了</button>" +
            "</div>" +
            "</div></div></div>" +
            "<div tabindex='0' style='width:0;height:0;overflow:hidden;' data-reactid='.2.$dialog.1'>sentinel</div></div></div></div>");
    }

    // 所有订单都删除了或者还原了，则设置页面数据为空状态
    var emptyStatus = function () {
        // 获得所有订单，判断长度
        var orderCount = $(".js-order-container").length;
        if(orderCount < 1){
            $(".operating").remove();
            $(".js-empty-list").show();
        }
    }
</script>
</html>
